import Vue from 'vue';
import Vuex from 'vuex';

// import { tianditu, tiandituZJ, tiandituYX } from "../../libs/tianditu";

Vue.use(Vuex);
export default new Vuex.Store({
	state: {
		docLayer: null, //地图文档
		map: null, //map对象
		usertype: false, // true 表示普通用户登录 false表示 交管部门登录
		roadsResult: null, // 查询的道路结果
		isShowRoads: false, // 是否显示实时路况的查询结果
		drawRoads: [],
		userName: null, //存储当前登录用户的用户名
		userId: null, // 当前用户的id
		isHeatMap: false, //是否显示热力图
	},
	mutations: {
		// 实例化图层对象
		addMap(state, map) {
			state.map = map;
		},
		// 加载图层
		addLayer(state, docLayer) {
			state.docLayer = docLayer;
		},
		// 获取用户类型
		defUserType(state, val) {
			state.usertype = val;
		},
		drawRoad(state, val) {
			state.drawRoads = val;
		},
		changeisShowRoads(state, val) {
			state.isShowRoads = val;
		},
		defUserId(state, val) {
			state.userId = val;
		},
		defUserName(state, val) {
			state.userName = val;
		},
		heatMapState(state, val) {
			state.isHeatMap = val;
		},
	},
	actions: {},
});
